const path = require('path')
const db = require(path.resolve(__dirname,'../db'))
const appConfig = require(path.resolve(__dirname,'../config/setting'))
const jsonwebtoken = require("jsonwebtoken");

exports.login = (req , res) => {
	// console.log(req.body);
	const secretData = 'token ' + req.body.code
	const token = jsonwebtoken.sign({secretData} , appConfig.tokenSecretKey , {
		expiresIn:10
	})
	res.status(200).send({
		token:"Bearer " + token
	})
}